/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ies.domain.model.util;

import com.ies.domain.model.repository.facades.CidadeFacade;
import com.ies.domain.model.repository.facades.EstadoFacade;
import com.ies.domain.model.repository.facades.PaisFacade;

import com.ies.domain.model.repository.facades.PermissaoFacade;
import com.ies.domain.model.repository.facades.UsuarioFacade;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 *
 * @author gustavo
 */
public class StartUp implements ServletContextListener {
    
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        carregarFacades(sce);
    }
    
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
       
    }
    
    private void carregarFacades(ServletContextEvent sce) {
        JpaPool.getInstancia().addFacades(new PermissaoFacade());
        JpaPool.getInstancia().addFacades(new PaisFacade());
        JpaPool.getInstancia().addFacades(new EstadoFacade());
        JpaPool.getInstancia().addFacades(new CidadeFacade());
        JpaPool.getInstancia().addFacades(new UsuarioFacade());
        new UsuarioFacade().count();
        
    }
}
